package com.zhika.zishi.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhika.zishi.R;
import com.zhika.zishi.adapter.ViewsPagerAdapter;
import com.zhika.zishi.customview.TitleView;
import com.zhika.zishi.interfaces.TitleInterface;

import java.util.ArrayList;

/**
 * Created by shi-02 on 2015/4/24.
 */
public class BigPictureActivity extends BaseActivity {

    private TextView sureText;

    private TitleView titleView;

    private ViewPager viewPager;

    private ViewsPagerAdapter adapter;

    private ArrayList<View> viewArrayList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.big_picture_layout);

        initView();
    }

    private void initView(){
        sureText = (TextView) findViewById(R.id.big_picture_sure_text);
        sureText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BigPictureActivity.this,NewCompareActivity.class);
                startActivity(intent);
            }
        });
        titleView = (TitleView) findViewById(R.id.big_picture_title_view);
        titleView.setLeftButtonText("返回");
        titleView.setRightButtonText("已选");
        titleView.hideMiddle();
        titleView.setTitleViewInterface(new TitleInterface() {
            @Override
            public void leftTitleListener() {
                finish();
            }

            @Override
            public void middleTitleListener() {

            }

            @Override
            public void rightTitleListener() {

            }
        });

        viewPager = (ViewPager) findViewById(R.id.big_picture_view_pager);

        for (int i = 0;i<10;i++){
            View view = LayoutInflater.from(this).inflate(R.layout.big_image_view,null);
            ImageView imageView = (ImageView) view.findViewById(R.id.big_image_view_image_view);
            imageView.setImageResource(R.drawable.test_1);

            viewArrayList.add(view);
        }

        adapter = new ViewsPagerAdapter(viewArrayList);
        viewPager.setAdapter(adapter);

    }
}
